package com.digitalchina.lxnsy.viewholder;

import android.view.ViewGroup;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.PesticideVO;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：郑皓
 * 创建时间：2017/4/7 15:21
 * 修改备注：
 * ================================================
 */
public class PestDetailHolder extends BaseViewHolder<PesticideVO> {

    public TextView title;
    public TextView type;
    public TextView controlObject;
    public TextView manufacturer;

    public PestDetailHolder(ViewGroup parent) {
        super(parent, R.layout.item_pesticide_details_list);
        title = $(R.id.item_pesticide_list_tv_title);
        type = $(R.id.item_pesticide_list_tv_type);
        controlObject = $(R.id.item_pesticide_list_tv_control_object);
        manufacturer = $(R.id.item_pesticide_list_tv_manufacturer);
    }

    @Override
    public void setData(PesticideVO data) {
        super.setData(data);
        title.setText(null == data.getName() ? "" : data.getName());
        type.setText(String.format("类型：%s", null == data.getPesticideType() ? "" : null == data.getPesticideType().getName() ? "" : data.getPesticideType().getName()));
        controlObject.setText(String.format("防治对象：%s", null == data.getPrevention() ? "" : data.getPrevention()));
        manufacturer.setText(String.format("厂商：%s", null == data.getManufacturer() ? "" : data.getManufacturer()));
    }
}
